﻿using com.youzu.warh.protocol;
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;

namespace Yoozoo.Gameplay.Liberty.AI.Node
{
    [Category("Ggame/Liberty")]
    public class NpcWaitShootingCD : AIBaseNode
    {
        private float waitTime = 0f;

        protected override void OnExecute()
        {
            if (_entity.WeaponSystem.HandleWeapon != null)
            {
                waitTime = _entity.WeaponSystem.HandleWeapon.Config.shooting_cd;
            }
            else
            {
                waitTime = 0;
            }
        }
        
        protected override void OnUpdate() {
            if ( elapsedTime >= waitTime ) {
                EndAction(true);
            }
        }
        
    }
}